package cn.jobstart.spider.downloader;

import cn.jobstart.modelExt.TalentSubscriptionTaskExt;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;

/**
 * @author sunke
 * @version 1.0
 * @Description 51job 人才 下载器
 * @date 2023-10-09 15:30
 */
public class TalentJob51SeleniumDownloader extends SeleniumDownloader {

    public TalentSubscriptionTaskExt getTalentSubscriptionTask() {
        return talentSubscriptionTask;
    }

    public TalentJob51SeleniumDownloader setTalentSubscriptionTask(TalentSubscriptionTaskExt talentSubscriptionTask) {
        this.talentSubscriptionTask = talentSubscriptionTask;
        return this;
    }

    private TalentSubscriptionTaskExt talentSubscriptionTask;



    private boolean needSearchCondition = true;





    /**
     * 新建
     *
     * @param chromeDriverPath chromeDriverPath
     */
    public TalentJob51SeleniumDownloader(String chromeDriverPath) {
        super(chromeDriverPath);
    }

    @Override
    public void settingsSearchCondition() {
        if (needSearchCondition) {


            WebDriver webDriver =getWebDriver();

            String keyword=talentSubscriptionTask.getKeyword();
            webDriver.findElement(By.xpath("//*[@id=\"menuMainContainer\"]/section/div/div/div[1]/div[1]/div/div[1]/div/div[1]/div[2]/div/input")).sendKeys(keyword);
            setSleepTime(1000);
            webDriver.findElement(By.xpath("//*[@id=\"menuMainContainer\"]/section/div/div/div[1]/div[1]/div/div[1]/div/div[2]/button")).click();
            setSleepTime(5000);


            needSearchCondition = false;
        }

    }


}
